package com.ostrich.cloud.ostrichGoodsService.client;

import com.ostrich.cloud.common.result.Result;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.AddSecKillParam;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.SnappedGoodParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@FeignClient(contextId = "secKillClient",name="ostrichGoodsService")
public interface SecKillClient {


    @PostMapping("addSecKill")
    @ApiOperation("新增秒杀活动")
    public Result addSecKill(@RequestBody @Valid AddSecKillParam addSecKillParam) throws Exception;


    @GetMapping("getSecKill")
    @ApiOperation("获取秒杀商品")
    Result getSecKill(@RequestParam("status") String status);

    @GetMapping("snappedGood")
    @ApiOperation("用户进行秒杀")
    Result snappedGood(@RequestBody SnappedGoodParam snappedGoodParam);

    @GetMapping("getSecKillResult")
    @ApiOperation("获取秒杀结果")
    public Result getSecKillResult(@RequestParam("secId") Integer secId);

    @PutMapping("cancelSecKill")
    public Result cancelSecKill(@RequestParam("parentId") Integer parentId,
                                @RequestParam("orderId") Integer orderId) throws Exception;
}
